//
//  ST_AICenterDailyCell.swift
//  btvideo
//
//  Created by mac on 2020/7/24.
//  Copyright © 2020 JarvanZhang. All rights reserved.
//

import UIKit

class ST_AICenterDailyCell: UICollectionViewCell {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        contentView.addSubview(momentView)
        momentView.snp.makeConstraints { (make) in
            make.edges.equalToSuperview().inset(UIEdgeInsets.init(top: 0, left: -15, bottom: 0, right: -15))
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    var reload_cell_closure:((ST_AICenterDailyCell)->())?
    
    var comment_click_closure:((ST_AICenterDailyCell)->())?
    
    fileprivate lazy var momentView:ST_DailyMomentItemView = {
       let control = ST_DailyMomentItemView()
        control.displayWatchedBtn = true
        control.reload_cell_closure = { [weak self] in
            guard let strongSelf = self else{
                return
            }
            strongSelf.reload_cell_closure?(strongSelf)
        }
        
        control.comment_click_closure = {[weak self] in
            
            guard let strongSelf = self else{return}
            strongSelf.comment_click_closure?(strongSelf)
        }
        
        return control
    }()
    
    
    weak var model:DailyMomentOfHallModel?{
        didSet{
            momentView.model = model
        }
    }
    
}


//MARK: - 添加

class ST_AICenterAppendDailyCell: UICollectionViewCell {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.addSubview(push_daily_btn)
        push_daily_btn.snp.makeConstraints { (make) in
            make.edges.equalToSuperview().inset(UIEdgeInsets.init(top: 0, left: 0, bottom: 0, right: 0))
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    fileprivate lazy var push_daily_btn:ST_PushSheetView = {
            
        let control = ST_PushSheetView()
        
        control.model = ST_PushSheetViewModel.createDaily()
        
        control.addTarget(self, action: #selector(push_daily_handle), for: .touchUpInside)
        return control
    }()
    
    @objc fileprivate func push_daily_handle(){
        
        let vc = ST_SelectDailyMomentController()
        
        vc.title = "选择日常类型"
        
        self.parentViewController?.navigationController?.pushViewController(vc)
        
    }
}

